import java.io.File;
import java.io.IOException;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-09-04
 * Time: 17:49
 * To BE A Better Person-2020-3-2
 */
public class TestDemo3 {
    public static void main(String[] args) {
        //目录操作
        File file=new File("test");
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println("===========================");
        file.mkdir();
        //用mkdirs来创建多级目录
        //例如test/aa/1
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
    }
    public static void main3(String[] args) {
        File file=new File("hello.txt");
        System.out.println(file.exists());
        file.delete();
        System.out.println(file.exists());

    }
    public static void main2(String[] args) throws IOException {
        File file=new File("hello.txt");
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());
        System.out.println("===================");
        file.createNewFile();
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());

    }
    public static void main1(String[] args) throws IOException {
        //File file=new File("z:/test.txt");
        File file=new File("./test.txt");
        System.out.println(file.getParent());
        System.out.println(file.getName());
        System.out.println(file.getPath());
        System.out.println(file.getAbsolutePath());
        System.out.println(file. getCanonicalPath());
    }
}
